<template>
    <div>
        <el-card>
            <h3>{{pageName}}商户</h3>
            <div class="con">
                <el-form ref="addMerchformRef" :rules="addMerchformRules" :model="addMerchform" label-width="180px">
                    <el-form-item label="代理商ID:" prop="agent_id">
                        <el-select v-model="addMerchform.agent_id" placeholder="选择代理商">
                            <el-option :label="item.name" :value="item.id" v-for="(item,index) in AgentList" :key="index"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="商户类型：" prop="merchant_type">
                        <el-select v-model="addMerchform.merchant_type" placeholder="请选择活动区域">
                            <el-option label="企业商户" :value="1"></el-option>
                            <el-option label="事业单位商户" :value="2"></el-option>
                            <el-option label="个体工商户" :value="3"></el-option>
                            <el-option label="个人商户（小微商户）" :value="4"></el-option>
                            <el-option label="自然人" :value="5"></el-option>
                            <el-option label="其他组织" :value="6"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="营业执照:" prop="business_license" v-if="addMerchform.merchant_type==1||addMerchform.merchant_type==2||addMerchform.merchant_type==3||addMerchform.merchant_type==6">
                        <el-input v-model="addMerchform.user_file.business_license" style="display:none"></el-input>
                        <el-upload ref="imgUpload" :file-list="img_file.sanheyiList" action="http://openpay.duolaibei.com/admin/upload/businessLicense" name="image" :limit="1" list-type="picture" style="width:60%" :on-success="sanheyiUpSuccess">
                            <el-button size="small" type="primary">点击上传</el-button>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="商户名称:" prop="user_name">
                        <el-input v-model="addMerchform.user_name"></el-input>
                    </el-form-item>
                    <el-form-item label="商户简称:" prop="nick_name">
                        <el-input v-model="addMerchform.nick_name"></el-input>
                    </el-form-item>
                    <el-form-item label="组织机构代码证:" prop="org_num" v-if="addMerchform.merchant_type==1||addMerchform.merchant_type==2||addMerchform.merchant_type==3||addMerchform.merchant_type==6">
                        <el-input v-model="addMerchform.org_num"></el-input>
                    </el-form-item>
                    <el-form-item label="联系地址:" prop="address">
                        <el-input v-model="addMerchform.address"></el-input>
                    </el-form-item>
                    <el-form-item label="开户许可证:" prop="opening_account" v-if="addMerchform.merchant_type==1||addMerchform.merchant_type==2||addMerchform.merchant_type==6">
                        <el-input v-model="addMerchform.user_file.opening_account" style="display:none"></el-input>
                        <el-upload ref="imgUpload" :file-list="img_file.kaihuxukeList" action="http://openpay.duolaibei.com/admin/upload/upload" name="image" :limit="1" list-type="picture" style="width:60%" :on-success="kaihuxukeUpSuccess">
                            <el-button size="small" type="primary">点击上传</el-button>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="开户银行:" prop="bank_name">
                        <el-input v-model="addMerchform.bank_name"></el-input>
                    </el-form-item>
                    <el-form-item label="开户名:" prop="account_name">
                        <el-input v-model="addMerchform.account_name"></el-input>
                    </el-form-item>
                    <el-form-item label="开户账号:" prop="account_no">
                        <el-input v-model="addMerchform.account_no"></el-input>
                    </el-form-item>
                    <el-form-item label="结算卡:" prop="bank_card" v-if="addMerchform.merchant_type==3">
                        <el-input v-model="addMerchform.user_file.bank_card" style="display:none"></el-input>
                        <el-upload ref="imgUpload" :file-list="img_file.jiesuankaList" action="http://openpay.duolaibei.com/admin/upload/upload" name="image" :limit="1" list-type="picture" style="width:60%" :on-success="jiesuankaUpSuccess">
                            <el-button size="small" type="primary">点击上传</el-button>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="邮箱:" prop="email">
                        <el-input v-model="addMerchform.email"></el-input>
                    </el-form-item>
                    <el-form-item label="移动电话:" prop="mobile">
                        <el-input v-model="addMerchform.mobile"></el-input>
                    </el-form-item>
                    <el-form-item label="固定电话:（可选）">
                        <el-input v-model="addMerchform.tel"></el-input>
                    </el-form-item>
                    <el-form-item label="证件类型：" prop="cert_type">
                        <el-select v-model="addMerchform.cert_type" placeholder="请选择证件类型">
                            <el-option label="身份证" :value="1"></el-option>
                        </el-select>
                    </el-form-item>

                    <el-form-item label="身份证正面:" prop="front_card">
                        <el-input v-model="addMerchform.user_file.front_card" style="display:none"></el-input>
                        <el-upload ref="imgUpload" :file-list="img_file.cardfortList" action="http://openpay.duolaibei.com/admin/upload/idcardFront" name="image" :limit="1" list-type="picture" style="width:60%" :on-success="cardFrontUpSuccess">
                            <el-button size="small" type="primary">点击上传</el-button>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="身份证反面:" prop="back_card">
                        <el-input v-model="addMerchform.user_file.back_card" style="display:none"></el-input>
                        <el-upload ref="imgUpload" :file-list="img_file.cardbackList" action="http://openpay.duolaibei.com/admin/upload/idcardBack" name="image" :limit="1" list-type="picture" style="width:60%" :on-success="cardBackUpSuccess">
                            <el-button size="small" type="primary">点击上传</el-button>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="法人名字:" prop="legal_person">
                        <el-input v-model="addMerchform.legal_person"></el-input>
                    </el-form-item>
                    <el-form-item label="法人身份证号:" prop="legal_person_id">
                        <el-input v-model="addMerchform.legal_person_id"></el-input>
                    </el-form-item>
                    <el-form-item label="法人身份证开始日期:" prop="id_card_start_date">
                        <el-input v-model="addMerchform.id_card_start_date"></el-input>
                    </el-form-item>
                    <el-form-item label="法人身份证结束日期:" prop="id_card_end_date">
                        <el-input v-model="addMerchform.id_card_end_date"></el-input>
                    </el-form-item>
                    <el-form-item label="联系人姓名:" prop="linkman">
                        <el-input v-model="addMerchform.linkman"></el-input>
                    </el-form-item>
                    <el-form-item label="联系人电话:" prop="link_phone">
                        <el-input v-model="addMerchform.link_phone"></el-input>
                    </el-form-item>
                    <el-form-item label="结算卡联行号:" prop="bank_code">
                        <el-input v-model="addMerchform.bank_code"></el-input>
                    </el-form-item>
                    <el-form-item label="结算卡类型：" prop="settle_bank_type">
                        <el-select v-model="addMerchform.settle_bank_type" placeholder="结算卡类型：">
                            <el-option label="对公" :value="1"></el-option>
                            <el-option label="对私" :value="2"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="入账标识:" prop="settle_type">
                        <el-select v-model="addMerchform.settle_type" placeholder="入账标识：">
                            <el-option label="法人入账" :value="1"></el-option>
                            <el-option label="非法人入账" :value="2"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="经营类别:" prop="merchant_category">
                        <el-select v-model="addMerchform.merchant_category" placeholder="请选择经营类别">
                            <el-option :label="item.label" :value="item.label" v-for="(item,index) in busTypeList" :key="index"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="行业类型:" prop="industry_type_code">
                        <el-select v-model="addMerchform.industry_type_code" placeholder="请选择行业类型">
                            <el-option :label="item.label" :value="item.label" v-for="(item,index) in indTypeList" :key="index"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="商户费率:" prop="service_rate">
                        <el-input v-model="addMerchform.service_rate"></el-input>
                    </el-form-item>
                    <el-form-item label="结算类型：" prop="settlementPeriod">
                        <el-select v-model="addMerchform.settlementPeriod" placeholder="结算类型：">
                            <el-option label="T1" value="T1"></el-option>
                            <el-option label="D1" value="D1"></el-option>
                            <el-option label="D0" value="D0"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="手持身份证照:" prop="handheld_card" v-if="addMerchform.merchant_type==4||addMerchform.merchant_type==5||addMerchform.settle_type==2">
                        <el-input v-model="addMerchform.user_file.handheld_card" style="display:none"></el-input>
                        <el-upload ref="imgUpload" :file-list="img_file.shouchiCardList" action="http://openpay.duolaibei.com/admin/upload/upload" name="image" :limit="1" list-type="picture" style="width:60%" :on-success="shouchiCardUpSuccess">
                            <el-button size="small" type="primary">点击上传</el-button>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="手持银行卡照:" prop="handheld_bank" v-if="addMerchform.merchant_type==4||addMerchform.merchant_type==5||addMerchform.settle_type==2">
                        <el-input v-model="addMerchform.user_file.handheld_bank" style="display:none"></el-input>
                        <el-upload ref="imgUpload" :file-list="img_file.shouchiBankList" action="http://openpay.duolaibei.com/admin/upload/upload" name="image" :limit="1" list-type="picture" style="width:60%" :on-success="shouchiBankUpSuccess">
                            <el-button size="small" type="primary">点击上传</el-button>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="结算人身份证正面:" prop="front_settlement_card" v-if="addMerchform.merchant_type==3||addMerchform.merchant_type==4||addMerchform.merchant_type==5||addMerchform.settle_type==2">
                        <el-input v-model="addMerchform.user_file.front_settlement_card" style="display:none"></el-input>
                        <el-upload ref="imgUpload" :file-list="img_file.jiesuanrenTop" action="http://openpay.duolaibei.com/admin/upload/upload" name="image" :limit="1" list-type="picture" style="width:60%" :on-success="jiesuanrenTopUpSuccess">
                            <el-button size="small" type="primary">点击上传</el-button>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="结算人身份证反面:" prop="back_settlement_card" v-if="addMerchform.merchant_type==3 ||addMerchform.merchant_type==4||addMerchform.merchant_type==5||addMerchform.settle_type==2">
                        <el-input v-model="addMerchform.user_file.front_settlement_card" style="display:none"></el-input>
                        <el-upload ref="imgUpload" :file-list="img_file.jiesuanrenDown" action="http://openpay.duolaibei.com/admin/upload/upload" name="image" :limit="1" list-type="picture" style="width:60%" :on-success="jiesuanrenDownUpSuccess">
                            <el-button size="small" type="primary">点击上传</el-button>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="室内照:" prop="interior_photo">
                        <el-input v-model="addMerchform.user_file.interior_photo" style="display:none"></el-input>
                        <el-upload ref="imgUpload" :file-list="img_file.shineiList" action="http://openpay.duolaibei.com/admin/upload/upload" name="image" :limit="1" list-type="picture" style="width:60%" :on-success="shineiUpSuccess">
                            <el-button size="small" type="primary">点击上传</el-button>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="门头照:" prop="sign_doard">
                        <el-input v-model="addMerchform.user_file.sign_doard" style="display:none"></el-input>
                        <el-upload ref="imgUpload" :file-list="img_file.mentouList" action="http://openpay.duolaibei.com/admin/upload/upload" name="image" :limit="1" list-type="picture" style="width:60%" :on-success="mentouUpSuccess">
                            <el-button size="small" type="primary">点击上传</el-button>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="特殊资质（可选）:">
                        <el-upload ref="imgUpload" action="http://openpay.duolaibei.com/admin/upload/upload" name="image" :limit="1" list-type="picture" style="width:60%" :on-success="teshuzizhiUpSuccess">
                            <el-button size="small" type="primary">点击上传</el-button>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="补充图片（可选）:">
                        <el-upload ref="imgUpload" action="http://openpay.duolaibei.com/admin/upload/upload" name="image" :limit="1" list-type="picture" style="width:60%" :on-success="buchongUpSuccess">
                            <el-button size="small" type="primary">点击上传</el-button>
                        </el-upload>
                    </el-form-item>
                    <el-form-item label="备注（选填）:">
                        <el-input type="textarea" v-model="addMerchform.note"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onSubmit(addMerchform)">立即创建</el-button>
                        <el-button>取消</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </el-card>
    </div>
</template>
<script>
export default {
    data() {
        return {
            pageName: '新增',
            identity: 'user',
            // 新增商户 form表单
            addMerchform: {
                agent_id: 1,
                user_name: '',
                // nick_name: '',
                // email: '',
                // mobile: '',
                // tel: '',
                // merchant_type: '',
                cert_type: 1,
                legal_person: '',
                legal_person_id: '',
                org_num: '0',
                address: '',
                // linkman: '',
                // link_phone: '',
                // bank_code: '',
                // account_name: '',
                // account_no: '',
                // settle_bank_type: '',
                // merchant_category: '',
                // industry_type_code: '',
                // service_rate: '',
                // settlementPeriod: '',
                id_card_start_date: '',
                id_card_end_date: '',
                user_file: {},
            },
            img_file:{
                sanheyiList: [],
				kaihuxukeList: [],
				jiesuankaList: [],
				cardfortList: [],
				cardbackList: [],
				shouchiCardList: [],
				shouchiBankList: [],
				jiesuanrenTop: [],
				jiesuanrenDown: [],
				shineiList: [],
				mentouList: [],
            },
            // 代理商列表
            AgentList:[],
            // 经营类型选择
            busTypeList: [],
            // 行业类型选择
            indTypeList: [],
            addMerchformRules: {
                status: [
                    { required: true, message: '请选择商户状态', trigger: 'change' },
                ],
                agent_id: [
                    { required: true, message: '请输入代理商ID', trigger: 'change' },
                ],
                merchant: [
                    { required: true, message: '请输入商户号', trigger: 'blur' }
                ],
                user_name: [
                    { required: true, message: '请输入商户名称', trigger: 'blur' }
                ],
                nick_name: [
                    { required: true, message: '请输入商户简称', trigger: 'blur' }
                ],
                bank_name: [
                    { required: true, message: '请输入开户银行', trigger: 'blur' }
                ],
                email: [
                    { required: true, message: '请输入邮箱', trigger: 'blur' }
                ],
                mobile: [
                    { required: true, message: '请输入电话', trigger: 'blur' }
                ],
                merchant_type: [
                    { required: true, message: '请选择商户类型', trigger: 'change' }
                ],
                cert_type: [
                    { required: true, message: '请选择法人证件类型', trigger: 'change' }
                ],
                legal_person: [
                    { required: true, message: '请输入法人名字', trigger: 'blur' }
                ],
                legal_person_id: [
                    { required: true, message: '请输入法人身份证号', trigger: 'blur' }
                ],
                org_num: [
                    { required: true, message: '请输入组织机构代码证', trigger: 'blur' }
                ],
                address: [
                    { required: true, message: '请输入联系地址', trigger: 'blur' }
                ],
                linkman: [
                    { required: true, message: '请输入联系人姓名', trigger: 'blur' }
                ],
                link_phone: [
                    { required: true, message: '请输入联系人电话', trigger: 'blur' }
                ],
                bank_code: [
                    { required: true, message: '请输入结算卡联行号', trigger: 'blur' }
                ],
                account_name: [
                    { required: true, message: '请输入开户名', trigger: 'blur' }
                ],
                account_no: [
                    { required: true, message: '请输入开户账号', trigger: 'blur' }
                ],
                settle_bank_type: [
                    { required: true, message: '请选择结算卡类型', trigger: 'change' }
                ],
                settle_type: [
                    { required: true, message: '请选择入账标识', trigger: 'change' }
                ],
                merchant_category: [
                    { required: true, message: '请输入经营类别', trigger: 'blur' }
                ],
                industry_type_code: [
                    { required: true, message: '请输入行业类型编码', trigger: 'blur' }
                ],
                service_rate: [
                    { required: true, message: '请输入商户费率', trigger: 'blur' }
                ],
                settlementPeriod: [
                    { required: true, message: '请选择结算类型', trigger: 'change' }
                ],
                id_card_start_date: [
                    { required: true, message: '请选择开始日期', trigger: 'blur' }
                ],
                id_card_end_date: [
                    { required: true, message: '请选择结束日期', trigger: 'blur' }
                ],
                // front_card: [
                //     {required:true,
                //         validator: (rule, value, callback) => {
                //             if (this.addMerchform.user_file.front_card == undefined) {
                //                 callback(new Error('上传身份证正面'));
                //             } else {
                //                 callback();
                //             }
                //         },
                //         trigger: 'change'
                //     }
                // ],
                // back_card: [
                //     {required:true,
                //         validator: (rule, value, callback) => {
                //             if (this.addMerchform.user_file.back_card == undefined) {
                //                 callback(new Error('上传身份证反面'));
                //             } else {
                //                 callback();
                //             }
                //         }, trigger: 'change'
                //     }
                // ],
                // business_license: [
                //     {   required:true,
                //         validator: (rule, value, callback) => {
                //             if (this.addMerchform.user_file.business_license == undefined) {
                //                 callback(new Error('请上传营业执照'));
                //             } else {
                //                 callback();
                //             }
                //         }, trigger: 'change'
                //     }
                // ],
                // opening_account: [
                //     {required:true,
                //         validator: (rule, value, callback) => {
                //             if (this.addMerchform.user_file.opening_account == undefined) {
                //                 callback(new Error('上传开户许可证'));
                //             } else {
                //                 callback();
                //             }
                //         },
                //         trigger: 'change'
                //     }
                // ],
                // bank_card: [
                //     {required:true,
                //         validator: (rule, value, callback) => {
                //             if (this.addMerchform.user_file.bank_card == undefined) {
                //                 callback(new Error('上传结算卡'));
                //             } else {
                //                 callback();
                //             }
                //         }, trigger: 'change'
                //     }
                // ],
                // handheld_card: [
                //     {required:true,
                //         validator: (rule, value, callback) => {
                //             if (this.addMerchform.user_file.handheld_card == undefined) {
                //                 callback(new Error('上传手持身份证'));
                //             } else {
                //                 callback();
                //             }
                //         },
                //         trigger: 'change'
                //     }
                // ],
                // handheld_bank: [
                //     {required:true,
                //         validator: (rule, value, callback) => {
                //             if (this.addMerchform.user_file.handheld_bank == undefined) {
                //                 callback(new Error('上传手持银行卡'));
                //             } else {
                //                 callback();
                //             }
                //         },
                //         trigger: 'change'
                //     }
                // ],
                // front_settlement_card: [
                //     {required:true,
                //         validator: (rule, value, callback) => {
                //             if (this.addMerchform.user_file.front_settlement_card == undefined) {
                //                 callback(new Error('上传结算人身份证正面'));
                //             } else {
                //                 callback();
                //             }
                //         },
                //         trigger: 'change'
                //     }
                // ],
                // back_settlement_card: [
                //     {required:true,
                //         validator: (rule, value, callback) => {
                //             if (this.addMerchform.user_file.back_settlement_card == undefined) {
                //                 callback(new Error('上传结算人身份证反面'));
                //             } else {
                //                 callback();
                //             }
                //         },

                //         trigger: 'change'
                //     }
                // ],
                // interior_photo: [
                //     {required:true,
                //         validator: (rule, value, callback) => {
                //             if (this.addMerchform.user_file.interior_photo == undefined) {
                //                 callback(new Error('上传室内照'));
                //             } else {
                //                 callback();
                //             }
                //         },

                //         trigger: 'change'
                //     }
                // ],
                // sign_doard: [
                //     {required:true,
                //         validator: (rule, value, callback) => {
                //             if (this.addMerchform.user_file.sign_doard == undefined) {
                //                 callback(new Error('上传门头照'));
                //             } else {
                //                 callback();
                //             }
                //         },
                //         trigger: 'change'
                //     }
                // ]
            }
        };
    },
    created() {
        this.identityAndType();
        this.getAgentList();
        this.getBusTypeList();
        this.getIndTypeList();
    },
    methods: {
        identityAndType() {
            let type = this.$route.query.type,form=this.$route.query.form;
            this.identity = this.$route.query.identity;
            if (type != 0) {
                this.pageName = '修改';
                this.addMerchform =form;
                this.img_file.sanheyiList.push({url:form.user_file.business_license});
                this.img_file.kaihuxukeList.push({url:form.user_file.opening_account});
                this.img_file.jiesuankaList.push({url:form.user_file.bank_card});
                this.img_file.cardfortList.push({url:form.user_file.front_card});
                this.img_file.cardbackList.push({url:form.user_file.back_card});
                this.img_file.shouchiCardList.push({url:form.user_file.handheld_card});
                this.img_file.shouchiBankList.push({url:form.user_file.handheld_bank});
                this.img_file.jiesuanrenTop.push({url:form.user_file.front_settlement_card});
                this.img_file.jiesuanrenDown.push({url:form.user_file.back_settlement_card});
                this.img_file.shineiList.push({url:form.user_file.interior_photo});
                this.img_file.mentouList.push({url:form.user_file.sign_doard});
            } else {
                this.pageName = '新增';
            }
        },
        // 获取经营类型选项
        getBusTypeList() {
            let _this = this;
            this.$axios({
                url: '/admin/conf/getCategory',
                data: {
                    type: 0
                },
                success(res) {
                    if (res.data.code === 200) {
                        _this.busTypeList = res.data.content;
                    }
                }
            });
        },
        // 获取行业类型选择
        getIndTypeList() {
            let _this = this;
            this.$axios({
                url: '/admin/conf/getIndustry',
                data: {
                    type: 0
                },
                success(res) {
                    if (res.data.code === 200) {
                        _this.indTypeList = res.data.content;
                    }
                }
            });
        },
        getAgentList() {
            let _this = this;
            this.$axios({
                url: '/admin/master/getAgentList',
                success(res) {
                    if (res.data.code === 200) {
                        _this.AgentList = res.data.content;
                    }
                }
            });
        },
        // 确认添加/编辑商户
        onSubmit(form) {
            let _this = this;
            this.$refs['addMerchformRef'].validate((valid) => {
                if (valid) {
                    this.$confirm(`确认要${_this.pageName}商户?`, '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(() => {
                        _this.submintMerchant(_this.$route.query.type, form);
                    }).catch(() => {
                        this.$message({
                            type: 'info',
                            message: '取消'
                        });
                    });
                }
            });
        },
        // 提交创建商户
        submintMerchant(type, form) {
            let _this = this;
            //type 0: 新增 1：修改
            var data = {};
            data = {
                userID:type==1?form.id:'',
                status: 0,
                agent_id: form.agent_id,
                user_name: form.user_name,
                nick_name: form.nick_name,
                email: form.email,
                mobile: form.mobile,
                tel: form.tel?form.tel:null,
                merchant_type: form.merchant_type,
                cert_type: form.cert_type,
                legal_person: form.legal_person,
                legal_person_id: form.legal_person_id,
                org_num: form.org_num,
                address: form.address,
                linkman: form.linkman,
                link_phone: form.link_phone,
                bank_name: form.bank_name,
                bank_code: form.bank_code,
                account_name: form.account_name,
                account_no: form.account_no,
                settle_bank_type: form.settle_bank_type,
                merchant_category: form.merchant_category,
                industry_type_code: form.industry_type_code,
                settle_type:form.settle_type,
                note:form.note?form.note:null,
                service_rate: form.service_rate,
                settlementPeriod: form.settlementPeriod,
                id_card_start_date: form.id_card_start_date,
                id_card_end_date: form.id_card_end_date,
                userFile: JSON.stringify(form.user_file)
            }
            this.$axios({
                url: "/admin/general/setUser",
                data: data,
                success(res) {
                    if (res.data.code == 200) {
                        _this.$message({
                            type: "success",
                            message: `${_this.pageName}完成`,
                        });
                        // _this.$refs['addMerchformRef'].resetFields();
                        // _this.$refs.imgUpload.clearFiles();
                        _this.$router.go(-1);
                    }else{
                        _this.$message.error(res.data.msg)
                    }
                },
            });
        },
        // 所有的图片上传
        sanheyiUpSuccess(response, file, fileList) {
            if (response.code == 200) {
                let con = response.content;
                this.addMerchform.address = con.address;
                this.addMerchform.user_name = con.companyName;
                this.addMerchform.org_num = con.licenseNo
                this.addMerchform.user_file.business_license = con.path;
                this.$message({
                    type: 'success',
                    message: response.msg
                });
            } else {
                this.$message({
                    type: "warning",
                    message: response.msg
                });
            }
        },
        kaihuxukeUpSuccess(response, file, fileList) {
            if (response.code == 200) {
                let con = response.content;
                this.addMerchform.user_file.opening_account = con.path;
                this.$message({
                    type: 'success',
                    message: response.msg
                });
            } else {
                this.$message({
                    type: "warning",
                    message: response.msg
                });
            }
        },
        jiesuankaUpSuccess(response, file, fileList) {
            if (response.code == 200) {
                let con = response.content;
                this.addMerchform.user_file.bank_card = con.path;
                this.$message({
                    type: 'success',
                    message: response.msg
                });
            } else {
                this.$message({
                    type: "warning",
                    message: response.msg
                });
            }
        },
        cardFrontUpSuccess(response, file, fileList) {
            if (response.code == 200) {
                let con = response.content;
                this.addMerchform.legal_person_id=con.idNumb;
				this.addMerchform.legal_person=con.name;
				this.addMerchform.user_file.front_card=con.path;
                this.$message({
                    type: 'success',
                    message: response.msg
                });
            } else {
                this.$message({
                    type: "warning",
                    message: response.msg
                });
            }
        },
        cardBackUpSuccess(response, file, fileList) {
            if (response.code == 200) {
                let con = response.content;
                this.addMerchform.id_card_start_date=con.starttime;
				this.addMerchform.id_card_end_date=con.overtime;
				this.addMerchform.user_file.back_card=con.path;
                this.$message({
                    type: 'success',
                    message: response.msg
                });
            } else {
                this.$message({
                    type: "warning",
                    message: response.msg
                });
            }
        },
        shouchiCardUpSuccess(response, file, fileList) {
            if (response.code == 200) {
                let con = response.content;
                this.addMerchform.user_file.handheld_card=con.path;
                this.$message({
                    type: 'success',
                    message: response.msg
                });
            } else {
                this.$message({
                    type: "warning",
                    message: response.msg
                });
            }
        },
        shouchiBankUpSuccess(response, file, fileList) {
            if (response.code == 200) {
                let con = response.content;
                this.addMerchform.user_file.handheld_bank=con.path;
                this.$message({
                    type: 'success',
                    message: response.msg
                });
            } else {
                this.$message({
                    type: "warning",
                    message: response.msg
                });
            }
        },
        jiesuanrenTopUpSuccess(response, file, fileList) {
            if (response.code == 200) {
                let con = response.content;
                this.addMerchform.user_file.front_settlement_card = con.path;
                this.$message({
                    type: 'success',
                    message: response.msg
                });
            } else {
                this.$message({
                    type: "warning",
                    message: response.msg
                });
            }
        },
        jiesuanrenDownUpSuccess(response, file, fileList) {
            if (response.code == 200) {
                let con = response.content;
                this.addMerchform.user_file.back_settlement_card = con.path;
                this.$message({
                    type: 'success',
                    message: response.msg
                });
            } else {
                this.$message({
                    type: "warning",
                    message: response.msg
                });
            }
        },
        shineiUpSuccess(response, file, fileList) {
            if (response.code == 200) {
                let con = response.content;
                this.addMerchform.user_file.interior_photo = con.path;
                this.$message({
                    type: 'success',
                    message: response.msg
                });
            } else {
                this.$message({
                    type: "warning",
                    message: response.msg
                });
            }
        },
        mentouUpSuccess(response, file, fileList) {
            if (response.code == 200) {
                let con = response.content;
                this.addMerchform.user_file.sign_doard = con.path;
                this.$message({
                    type: 'success',
                    message: response.msg
                });
            } else {
                this.$message({
                    type: "warning",
                    message: response.msg
                });
            }
        },
        teshuzizhiUpSuccess(response, file, fileList) {
            if (response.code == 200) {
                let con = response.content;
                this.addMerchform.user_file.special_card = con.path;
                this.$message({
                    type: 'success',
                    message: response.msg
                });
            } else {
                this.$message({
                    type: "warning",
                    message: response.msg
                });
            }
        },
        buchongUpSuccess(response, file, fileList) {
            if (response.code == 200) {
                let con = response.content;
                this.addMerchform.user_file.supplement_photo = con.path;
                this.$message({
                    type: 'success',
                    message: response.msg
                });
            } else {
                this.$message({
                    type: "warning",
                    message: response.msg
                });
            }
        },
    }
};
</script>
<style scoped>
.con {
    margin: 30px auto 0 auto;
    width: 50%;
}
</style>